package cn.liutao.bill.api;

import cn.liutao.bill.service.BillService;
import cn.liutao.bill.vo.OverallVo;
import cn.liutao.common.utils.AuthUtils;
import cn.liutao.common.utils.ServletUtils;

import javax.servlet.ServletException;
import javax.servlet.annotation.WebServlet;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.io.IOException;

/**
 * @author liutao
 * @Description 数据总览
 * @date 2023/11/4
 */
@WebServlet("/bill/overall")
public class OverallServlet extends HttpServlet {
    private BillService billService;
    @Override
    public void init() throws ServletException {
        billService = BillService.getInstance();
    }

    /**
     * 销售总览
     * @param req
     * @param resp
     * @throws ServletException
     * @throws IOException
     */
    @Override
    protected void doGet(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException {
        AuthUtils.isAdmin();
        OverallVo overallVo = billService.getOverall();
        ServletUtils.ok(resp,overallVo);
    }
}
